﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Ecodex.RestAPI;

namespace EcodexIntegrationSample
{
    internal class TranslateErrorAPI
    {

        public static Entity.ServiceError ToServiceError(String RFC, Ecodex.RestAPI.Exceptions.FallaAplicacion from)
        {
            var to = new Entity.ServiceError
            {                
                RFC = RFC,
                Number = from.Codigo,
                Description = from.Message
            };
            return to;
        }

        public static Entity.SessionError ToSessionError(String RFC, Ecodex.RestAPI.Exceptions.FallaSesion from)
        {
            var to = new Entity.SessionError
            {
                 RFC = RFC,
                 Description = from.Mensaje,
                 Status = from.Codigo 
            };
            return to;
        }

        public static Entity.ServiceError ToServiceError(String RFC, Ecodex.RestAPI.Exceptions.FallaValidacion from)
        {
            var to = new Entity.ServiceError
            {
                RFC = RFC,
                Number = from.Codigo,
                Description = from.Message
            };
            return to;
        }
    }
}
